<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            margin: 0 auto;
        }

        .parent{
            width:300px;
            height: 200px;
            background-color: skyblue;
        }

        .child{
            width:200px;
            height: 200px;
            background-color: orange;
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="child"></div>
    </div>

    <script>
        var parentBox = document.getElementsByClassName('parent')[0];
        parentBox.addEventListener('mouseenter',function(){
            console.log('enter版移入');
        })
        parentBox.addEventListener('mouseleave',function(){
            console.log('leave版移出');
        })
        parentBox.addEventListener('mouseover',function(){
            console.log('over版移入');
        })
        parentBox.addEventListener('mouseout',function(){
            console.log('out版移出');
        });


        // 如果 从外进入 移出父元素  over out  和 leave enter 都会被触发  
        // 没有区别  


        // 如果从父元素进入子元素 再从子元素进入父元素 
        // over out 被触发 
        // enter leave 不被触发 
    </script>
</body>
</html>